package com.hx.spring6;

import org.junit.jupiter.api.Test;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

/**
 * @author shx
 */
public class TestUserTest {

    @Test
    public void testUserObject(){
         /*User user = new User();
        user.add();*/
        //加载spring配置文件 对象创建
        ApplicationContext applicationContext = new ClassPathXmlApplicationContext("bean.xml");
        //获取创建的对象
        User user = (User) applicationContext.getBean("user");

        System.out.println("1:"+user);


        //使用对象调用方法进行测试
        System.out.print("2:");
        user.add();
    }
}
